const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
  navigate: (direction) => {
    console.log('preload: Sending navigate command to main process', direction);
    ipcRenderer.send('navigate', direction);
  },
  onChangePage: (callback) => ipcRenderer.on('change-page', callback),
  removeChangePage: (callback) => ipcRenderer.removeListener('change-page', callback),

  sendKnobValue: (knob, value) => ipcRenderer.send('send-knob-value', { knob, value })
});

console.log('preload script executed');